<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 999;
        }
        .modal {
            background-color: white;
            padding: 2rem;
            border-radius: 0.5rem;
            text-align: center;
            max-width: 700px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-around;
        }
        .gif-container {
            margin-bottom: 2rem;
            max-width: 100%;
            height: auto;
        }
        .audio-player {
            display: none;
        }
        .result {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            padding: 20px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0,0,0,0.3);
            text-align: center;
            z-index: 999;
            width: 300px;
        }
        .start-button {
            font-size: 1.5rem;
            padding: 1rem 2rem;
            background-color: #007bff;
            border: none;
            border-radius: 0.5rem;
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .start-button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <div class="overlay">
        <div class="modal">
            <img src="gifAndmp3/前.jpg"  class="gif-container" id="drawGif">
            <audio class="audio-player" src="gifAndmp3/bgm.MP3" preload="auto" loop></audio>
            <button class="start-button" id="startDraw">开始抽奖</button>
            <div class="result" id="drawResult"></div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const audio = document.querySelector('.audio-player');
            const startButton = document.getElementById('startDraw');
            const resultDiv = document.getElementById('drawResult');
            const drawGif = document.getElementById('drawGif');

            // 添加点击事件，播放音乐并更换动图
            startButton.addEventListener('click', function() {
                audio.play();
                this.style.display = 'none'; // 隐藏开始按钮
                drawGif.src = "gifAndmp3/币20.gif"; // 更换为抽奖进行中的动图
                drawGif.style.display = 'block'; // 显示新的动图

                setTimeout(() => {
                    audio.pause(); // 19秒后暂停音乐
                    drawGif.src = ""; // 清空动图源（可选，根据需要决定是否隐藏或清空）
                    drawGif.style.display = 'none'; // 动图消失
                    resultDiv.innerText = "恭喜您获得一等奖！"; // 显示预设的抽奖结果
                    resultDiv.style.display = 'block';
                }, 19000);
            });
        });
    </script>
</body>
</html>